
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rotempco.Core.ORM.ADAL;
using System.Data.SqlClient;
using Rotempco.BaseClass.Objects.EntityObjects;
using Rotempco.Core.ORM.Objects;
using Rotempco.Core.ORM.Objects.Enums;
using Rotempco.Core.ORM.Logic;
using Rotempco.Core.Logic;
using Rotempco.BaseClass.Objects.Enums;



namespace Rotempco.BaseClass.DAL
{
    public partial class TextTranslationData : ADAL<TextTranslation, long>
    {
	    #region [ ADATA Implementation ]

        protected override string GetTableName()
        {
            return "TextTranslation";
        }

        protected override Pair<string, string> GetIdentity()
        {
            return new Pair<string, string>("TextTranslationId", SymbolExtensions.GetPropertyName((TextTranslation d) => d.TextTranslationId));
        }

        protected override List<ORMParameter> GetORMMapping()
        {
            List<ORMParameter> mapping = new List<ORMParameter>();
		
			mapping.Add(new ORMParameter("LanguageType", SymbolExtensions.GetPropertyPair((TextTranslation d) => d.LanguageType)));
			mapping.Add(new ORMParameter("Guid", SymbolExtensions.GetPropertyPair((TextTranslation d) => d.Guid)));
			mapping.Add(new ORMParameter("Text", SymbolExtensions.GetPropertyPair((TextTranslation d) => d.Text)));

            return mapping;
        }

        #endregion

        #region [ GetBy ]

        public TextTranslation GetSingle(bool getDeleted = false, long? textTranslationId = null, LanguageTypeEnum? languageType = null, Guid? guid = null, string text = null )
        {
            List<PropertyPair> parameterList = GetByParameterList(textTranslationId: textTranslationId, languageType: languageType, guid: guid, text: text);
            List<NullablePair> nullablePairList = GetNullablePairList();
            return GetBy(parameterList, getDeleted, nullablePairList: nullablePairList).SingleOrDefault();
        }

        public List<TextTranslation> GetList(bool getDeleted = false, long? getFirstEntries = null, long? getLastEntries = null, long? textTranslationId = null, LanguageTypeEnum? languageType = null, Guid? guid = null, string text = null )
        {
            List<PropertyPair> parameterList = GetByParameterList(textTranslationId: textTranslationId, languageType: languageType, guid: guid, text: text);
            List<NullablePair> nullablePairList = GetNullablePairList();
            return GetBy(parameterList, getDeleted, getFirstEntries, getLastEntries, nullablePairList: nullablePairList);
        }

        #endregion

        #region [ Private ]

        private List<PropertyPair> GetByParameterList(long? textTranslationId = null, LanguageTypeEnum? languageType = null, Guid? guid = null, string text = null)
        {
            List<PropertyPair> mapping = new List<PropertyPair>();

			mapping.Add(new PropertyPair(textTranslationId, SymbolExtensions.GetPropertyPair((TextTranslation d) => d.TextTranslationId)));
			mapping.Add(new PropertyPair(languageType, SymbolExtensions.GetPropertyPair((TextTranslation d) => d.LanguageType)));
			mapping.Add(new PropertyPair(guid, SymbolExtensions.GetPropertyPair((TextTranslation d) => d.Guid)));
			mapping.Add(new PropertyPair(text, SymbolExtensions.GetPropertyPair((TextTranslation d) => d.Text)));

            return mapping;
        }

        private List<NullablePair> GetNullablePairList()
        {
            List<NullablePair> nullablePairList = new List<NullablePair>();



            if (nullablePairList.Count <= 0)
                return null;

            return nullablePairList;
        }

        #endregion

	}
}

